package com.txm.service;

import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;
 /**
* 读取properties文件，获取服务端的ip信息
* */
public class GetHostName {
    public static void main(String[] args) {
        System.out.println(GetHostName.getHost());
    }
    public static String getHost(){
        Properties properties = new Properties();
        try {
            properties.load(new FileReader("src/service.properties"));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return (String) properties.get("ip");
    }
    public static String getPort(){
        Properties properties = new Properties();
        try {
            properties.load(new FileReader("src/service.properties"));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return (String) properties.get("port");
    }
}
